{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Created spider 'liepinSpider' using template 'basic' in module:\n",
      "  liepin.spiders.liepinSpider\n"
     ]
    }
   ],
   "source": [
    "! scrapy genspider liepinSpider \"www.liepin.com\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "pycharm": {
     "is_executing": true
    }
   },
   "outputs": [],
   "source": [
    "!scrapy crawl liepinSpider"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>liepin_job</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0\\n0    学历不限\\n1   本科及以上\\n2   本科及以上\\n3 ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0\\n0   本科及以上\\n1   本科及以上\\n2   本科及以上\\n3 ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0\\n0   本科及以上\\n1    统招本科\\n2   本科及以上\\n3 ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0\\n0    学历不限\\n1   本科及以上\\n2   本科及以上\\n3 ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0\\n0   本科及以上\\n1   本科及以上\\n2   本科及以上\\n3 ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>0\\n0   硕士及以上\\n1   硕士及以上\\n2      博士\\n3 ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>0\\n0   本科及以上\\n1    学历不限\\n2    学历不限\\n3 ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>0\\n0    统招本科\\n1   本科及以上\\n2   本科及以上\\n3 ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>0\\n0   本科及以上\\n1   本科及以上\\n2   本科及以上\\n3 ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>0\\n0    学历不限\\n1   本科及以上\\n2    学历不限\\n3 ...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                          liepin_job\n",
       "0          0\\n0    学历不限\\n1   本科及以上\\n2   本科及以上\\n3 ...\n",
       "1          0\\n0   本科及以上\\n1   本科及以上\\n2   本科及以上\\n3 ...\n",
       "2          0\\n0   本科及以上\\n1    统招本科\\n2   本科及以上\\n3 ...\n",
       "3          0\\n0    学历不限\\n1   本科及以上\\n2   本科及以上\\n3 ...\n",
       "4          0\\n0   本科及以上\\n1   本科及以上\\n2   本科及以上\\n3 ...\n",
       "5          0\\n0   硕士及以上\\n1   硕士及以上\\n2      博士\\n3 ...\n",
       "6          0\\n0   本科及以上\\n1    学历不限\\n2    学历不限\\n3 ...\n",
       "7          0\\n0    统招本科\\n1   本科及以上\\n2   本科及以上\\n3 ...\n",
       "8          0\\n0   本科及以上\\n1   本科及以上\\n2   本科及以上\\n3 ...\n",
       "9          0\\n0    学历不限\\n1   本科及以上\\n2    学历不限\\n3 ..."
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import json\n",
    "df=pd.read_csv(\"liepin_jobs.csv\",sep=\"\\t\",encoding=\"utf-8\")#[\"liepin_job\"].str.contains('\"0')#.loc[0,\"liepin_job\"]\n",
    "df\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [],
   "source": [
    "df.to_excel(\"lie.xlsx\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'[        0\\n0   本科及以上\\n1   本科及以上\\n2   本科及以上\\n3    统招本科\\n4   本科及以上\\n5   本科及以上\\n6    学历不限\\n7    学历不限\\n8   本科及以上\\n9    学历不限\\n10  本科及以上\\n11   学历不限\\n12  本科及以上\\n13   学历不限\\n14  本科及以上\\n15  本科及以上\\n16  本科及以上\\n17  本科及以上\\n18  本科及以上\\n19  本科及以上\\n20  本科及以上\\n21  本科及以上\\n22  本科及以上\\n23  本科及以上\\n24  本科及以上\\n25  本科及以上\\n26  本科及以上\\n27  本科及以上\\n28   学历不限\\n29   学历不限\\n30  本科及以上\\n31  本科及以上\\n32   学历不限\\n33  本科及以上\\n34  本科及以上\\n35  本科及以上\\n36   学历不限\\n37  本科及以上\\n38  本科及以上\\n39   学历不限]'"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.loc[0,\"liepin_job\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
